home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / customfdialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-22  |  4.6 KB  |  152 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.                           customfdialog.h  -  description
  9.                              -------------------
  10.     begin                : Fri Nov 30 2001
  11.     copyright            : (C) 2001 by Franz Schmid
  12.     email                : Franz.Schmid@altmuehlnet.de
  13.  ***************************************************************************/
  14.  
  15. /***************************************************************************
  16.  *                                                                         *
  17.  *   This program is free software; you can redistribute it and/or modify  *
  18.  *   it under the terms of the GNU General Public License as published by  *
  19.  *   the Free Software Foundation; either version 2 of the License, or     *
  20.  *   (at your option) any later version.                                   *
  21.  *                                                                         *
  22.  ***************************************************************************/
  23.  
  24. #ifndef CUSTOMFDIALOG_H
  25. #define CUSTOMFDIALOG_H
  26.  
  27. #include <QDialog>
  28. #include <QFileIconProvider>
  29. #include <QLabel>
  30. class QPushButton;
  31. class QComboBox;
  32. class QCheckBox;
  33. class QHBoxLayout;
  34. class QVBoxLayout;
  35. class QFrame;
  36. class ScFileWidget;
  37. class QIcon;
  38.  
  39. #include "scribusapi.h"
  40.  
  41. /**
  42.   *@author Franz Schmid
  43.   */
  44. class SCRIBUS_API ImIconProvider : public QFileIconProvider
  45. {
  46. public:
  47.     ImIconProvider();
  48.     ~ImIconProvider() {};
  49.     QIcon icon(const QFileInfo &fi) const;
  50.     QStringList fmts;
  51.     QIcon imagepm;
  52.     QIcon docpm;
  53.     QIcon pspm;
  54.     QIcon pdfpm;
  55.     QIcon txtpm;
  56.     QIcon oosxdpm;
  57.     QIcon oosxwpm;
  58.     QIcon vectorpm;
  59. };
  60.  
  61. class SCRIBUS_API FDialogPreview : public QLabel
  62. {
  63.     Q_OBJECT
  64. public:
  65.     FDialogPreview(QWidget *pa);
  66.     ~FDialogPreview() {};
  67.     void updtPix();
  68.     void GenPreview(QString name);
  69. };
  70.  
  71. typedef enum {
  72.     fdNone = 0,
  73.     fdShowPreview = 1, // display text/image previewer
  74.     fdExistingFiles = 2, // When set, set to the QFileDialog::ExistingFile mode when true, QFileDialog::AnyFile otherwise
  75.     fdCompressFile = 4, // Show and handle the "Compress" behaviour and CheckBox (true)
  76.     fdShowCodecs = 8, // Show and handle text codecs and ComboBox (true)
  77.     fdDirectoriesOnly = 16, // Show only directories
  78.     fdHidePreviewCheckBox = 32 // Hide preview Checkbox
  79. } fdFlags;
  80.  
  81. /*! \brief A Scribus own file dialog.
  82. Used almost everywhere. You can see extension handling
  83. in e.g. bool SVGExportPlugin::run(QString filename).
  84. */
  85. class SCRIBUS_API CustomFDialog : public QDialog
  86. {
  87.     Q_OBJECT
  88. public:
  89.     /*! \brief Create Scribus file dialog.
  90.     \param parent a reference to the QWidget parent.
  91.     \param wDir starting working directory
  92.     \param caption text caption of the dialog window
  93.     \param filter a mask/filter. E.g.: *.txt
  94.     \param flags combination of fdFlags, default to fdExistingFiles
  95.     */
  96.     CustomFDialog(QWidget *parent, QString wDir, QString caption = "",  QString filter = "", int flags = fdExistingFiles);
  97.     ~CustomFDialog();
  98.  
  99.     /*! \brief Set the default extension of the resulting file name.
  100.     \param e string extension without any "."
  101.     */
  102.     void setExtension(QString e);
  103.     /*! \brief Get the file extension
  104.     \retval QString see setExtension(QString e) */
  105.     QString extension();
  106.     /*! \brief Set the "compress" extension of the resulting file name.
  107.     \param e string extension without any "."
  108.     */
  109.     void setZipExtension(QString e);
  110.     /*! \brief Get the zipped file extension
  111.     \retval QString see setZipExtension(QString e) */
  112.     QString zipExtension();
  113.  
  114.     QCheckBox* SaveZip;
  115.     QCheckBox* WithFonts;
  116.     QCheckBox* WithProfiles;
  117.     QFrame* Layout;
  118.     QFrame* LayoutC;
  119.     QComboBox *TxCodeM;
  120.     QLabel *TxCodeT;
  121.     ScFileWidget *fileDialog;
  122.     FDialogPreview *pw;
  123.     QCheckBox *showPreview;
  124.     QPushButton* OKButton;
  125.     QPushButton* CancelB;
  126.     void setSelection(QString );
  127.     QString selectedFile();
  128.     void addWidgets(QWidget *widgets);
  129. private slots:
  130.     //! \brief Go to the document home dir.
  131.     void fileClicked(const QString &path);
  132.     void togglePreview();
  133. public slots:
  134.     //! \brief Switch the filename extensions by compress checkbox state.
  135.     void handleCompress();
  136. protected:
  137.     QVBoxLayout *vboxLayout;
  138.     QVBoxLayout *vboxLayout1;
  139.     QHBoxLayout *hboxLayout;
  140.     QHBoxLayout* Layout1;
  141.     QHBoxLayout* Layout1C;
  142.     //! \brief Property with default extension
  143.     QString ext;
  144.     //! \brief Property with default compress extension
  145.     QString extZip;
  146.     //! \brief Option flags given by user in ctore
  147.     int optionFlags;
  148.     bool previewIsShown;
  149. };
  150.  
  151. #endif
  152.